# -*- coding:utf-8 -*-


from django.db import models

from Apps.common.custommodel import CustomModel
from Apps.user.models import User


class InterfaceStatus(CustomModel):
    status_code = models.CharField(null=True, blank=True, max_length=11, default='0',
                                   verbose_name='状态码(1-开发中，2-待完成，3-已完成)，添加状态，自增')
    status_name = models.CharField(null=True, blank=True, max_length=30, default='',
                                   verbose_name='状态名称')
    status_type = models.CharField(null=True, blank=True, max_length=4, default='2',
                                   verbose_name='状态类型(1-默认状态,2-自定义状态)')

    # 排序默认-1
    index_num = models.IntegerField(default="-1", verbose_name="排序")

    creator = models.ForeignKey(User, on_delete=models.DO_NOTHING, default="",
                                related_name="user_Status_c",
                                verbose_name="创建人")
    modifier = models.ForeignKey(User, on_delete=models.DO_NOTHING, default="",
                                 related_name="user_Status_m",
                                 verbose_name="修改人")

    class Meta:
        db_table = "interface_status"
        verbose_name = "接口状态表"
        ordering = ('-index_num', '-create_time',)

    def __str__(self):
        return self.id
